package com.area.cth.mapper;

import com.area.cth.pojo.Thumb;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface ThumbMapper {
    @Insert("insert into thumb(post_id,thumb_user)" +
            " values(#{pId},#{uId})")
    void addLike(Integer pId, Integer uId);

    @Select("select * from thumb where post_id=#{pId} and thumb_user=#{uId}")
    Thumb likeIf(Integer pId, Integer uId);

    @Delete("delete from thumb where id=#{lId}")
    void deleteLike(Integer lId);

    @Select("select count(1) from thumb where post_id=#{pId}")
    Integer thumbCount(Integer pId);
}
